Add Nuxt as a web framework option in fedify init#675
Add Nuxt as a web framework option in fedify init#6752chanhaeng wants to merge 6 commits intofedify-dev:mainfrom
fedify init#675Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (8)
📝 WalkthroughWalkthroughThis PR adds Nuxt as a supported web framework option to the Fedify init scaffolding tool. It introduces Nuxt framework registry entry, configuration templates, dependency specifications, and initialization logic with package manager support and port/test handling. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Code Review
This pull request introduces the @fedify/nuxt package to provide seamless integration between Fedify and the Nuxt framework, alongside updates to the fedify init tool for project scaffolding. The review feedback correctly identifies a critical bug in the Nuxt middleware template where the request body is ignored during manual Request construction, suggesting the use of toWebRequest from h3 as a fix. Furthermore, the feedback recommends enabling the @fedify/nuxt module by default in generated projects to simplify the setup and points out a typo in the Node.js type definitions version.
Codecov Report❌ Patch coverage is
... and 1 file with indirect coverage changes 🚀 New features to boost your workflow:
|
950c914 to
b4369b3
Compare
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
Actionable comments posted: 5
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In @.agents/skills/create-example-app-with-integration/SKILL.md:
- Around line 178-182: Change the hard-coded curl example that uses
"localhost:0000" to a parameterized form so users must supply the correct host
and port; update the example text in SKILL.md (the curl example block) to use a
clear placeholder such as "{HOST}:{PORT}" or "${HOST}:${PORT}" and mention a
sensible default (e.g., localhost:3000) so readers can copy/paste and
substitute their actual port before running the curl command.
In `@packages/init/src/templates/nuxt/server/middleware/federation.ts.tpl`:
- Around line 13-16: The middleware currently sets the request "body" to
undefined for all methods because the ternary always returns undefined; update
the federation middleware so that when event.node.req.method is NOT in
["GET","HEAD","DELETE"] you read and forward the actual request payload (e.g.,
await readBody(event) or the equivalent helper) into the body field instead of
undefined, and ensure the same content-type is preserved when calling the Fedify
endpoint (reference the body: property and event.node.req.method in the
federation middleware).
In `@packages/init/src/test/port.ts`:
- Around line 148-157: The code inserts nitro.port into nuxt.config.ts but
Nuxt's dev server port is controlled by devServer.port; change the replacement
so that defineNuxtConfig({ includes `devServer: { port: ${newPort} },` instead
of `nitro: { port: ${newPort} },` (affecting the writeFile call that replaces
"defineNuxtConfig({"). Also update the nearby comment that currently mentions
"Insert server.port into the Nuxt config (via nitro config in nuxt.config.ts)"
to accurately say it inserts devServer.port for the Nuxt dev server; keep
references to wf, configPath, readFile, writeFile, newPort and defineNuxtConfig
to locate the change.
In `@packages/init/src/webframeworks/nuxt.ts`:
- Around line 70-83: getDeps currently omits installing the peer dependency
`@nuxt/kit` for non-Deno package managers, causing unmet peer warnings; update the
non-Deno branch of getDeps (the ternary branch that returns "@fedify/nuxt",
"h3", "nuxt") to also include "@nuxt/kit": deps["npm:`@nuxt/kit`"] (mirroring the
Deno branch), keeping PACKAGE_VERSION and defaultDenoDependencies untouched so
that PackageManager handling and Deno-specific entries remain the same.
- Around line 61-68: getNuxtInitCommand currently invokes unpinned nuxi (e.g.,
"npm:nuxi@latest" or bare "nuxi"); update it to use the pinned nuxi version from
deps.json (use the same helper that exposes pinned versions, e.g., getDeps() or
the deps object) so every branch uses nuxi@<pinnedVersion>. Concretely, obtain
the pinned nuxi version (e.g., const { nuxi } = getDeps()) and interpolate it
into the command strings: for bun use ["bunx", `nuxi@${nuxi}`], for deno use
["deno", "-A", `npm:nuxi@${nuxi}`], for npm use ["npx", `nuxi@${nuxi}`], and for
other package managers use [pm, "dlx", `nuxi@${nuxi}`]; update
getNuxtInitCommand to reference that pinned variable.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: bd865655-4bd8-49e6-9fd3-c3268f58142d
⛔ Files ignored due to path filters (2)
deno.lockis excluded by!**/*.lockpnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (35)
.agents/skills/add-to-fedify-init/SKILL.md.agents/skills/create-example-app-with-integration/SKILL.md.agents/skills/create-example-app-with-integration/example/README.md.agents/skills/create-example-app-with-integration/example/src/logging.ts.agents/skills/create-integration-package/SKILL.md.hongdown.tomlAGENTS.mdCHANGES.mdCONTRIBUTING.mdcspell.jsondeno.jsondocs/manual/integration.mdmise.tomlpackages/fedify/README.mdpackages/init/src/const.tspackages/init/src/json/deps.jsonpackages/init/src/templates/nuxt/nuxt.config.ts.tplpackages/init/src/templates/nuxt/server/federation.ts.tplpackages/init/src/templates/nuxt/server/logging.ts.tplpackages/init/src/templates/nuxt/server/middleware/federation.ts.tplpackages/init/src/test/port.tspackages/init/src/webframeworks/mod.tspackages/init/src/webframeworks/nuxt.tspackages/nuxt/README.mdpackages/nuxt/deno.jsonpackages/nuxt/package.jsonpackages/nuxt/src/mod.test.tspackages/nuxt/src/mod.tspackages/nuxt/src/module.tspackages/nuxt/src/runtime/server/lib.tspackages/nuxt/src/runtime/server/logic.tspackages/nuxt/src/runtime/server/middleware.tspackages/nuxt/src/runtime/server/plugin.tspackages/nuxt/tsdown.config.tspnpm-workspace.yaml
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@packages/init/src/templates/nuxt/nuxt.config.ts.tpl`:
- Line 4: Update the fedify configuration in the template so the
federationModule path uses a single tilde; specifically change the
fedify.federationModule value from "~~/server/federation" to
"~/server/federation" in nuxt.config.ts.tpl to match the `@fedify/nuxt` defaults
and docs.
In `@packages/init/src/webframeworks/nuxt.ts`:
- Around line 70-78: The Deno branch of getDeps currently omits the npm-scoped
peer dependency required by `@fedify/nuxt`; update the Deno case in getDeps to
include the explicit mapping for `@nuxt/kit` by merging defaultDenoDependencies
with an entry for "@nuxt/kit" using the pinned value from deps (e.g.
deps["npm:`@nuxt/kit`"]) alongside the existing "@fedify/nuxt": PACKAGE_VERSION so
Deno will resolve the peer dependency correctly.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: c0e3750d-63cf-4b3b-aa48-1e3d99d056e5
📒 Files selected for processing (4)
packages/init/src/templates/nuxt/nuxt.config.ts.tplpackages/init/src/test/lookup.tspackages/init/src/test/port.tspackages/init/src/webframeworks/nuxt.ts
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In @.agents/skills/create-integration-package/SKILL.md:
- Around line 64-65: Replace the incorrect phrase "Use this commands" in
SKILL.md with "Use these commands" (locate the sentence containing "the
directory you created. Use this commands in the root path:") to fix grammar;
ensure the surrounding sentence remains unchanged except for that word
substitution.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: 05538584-ad26-4a4b-8850-ffd1237469db
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (17)
.agents/skills/create-example-app-with-integration/example/README.md.agents/skills/create-integration-package/SKILL.mdCHANGES.mdpackages/init/src/const.tspackages/init/src/json/deps.jsonpackages/init/src/templates/nuxt/nuxt.config.ts.tplpackages/init/src/test/lookup.tspackages/init/src/test/port.tspackages/init/src/webframeworks/mod.tspackages/init/src/webframeworks/nuxt.tspackages/nuxt/package.jsonpackages/nuxt/src/module.test.tspackages/nuxt/src/module.tspackages/nuxt/src/runtime/server/logic.test.tspackages/nuxt/src/runtime/server/logic.tspackages/nuxt/src/runtime/server/plugin.test.tspackages/nuxt/src/runtime/server/plugin.ts
bb22a01 to
2180e7e
Compare
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
Add Nuxt as a web framework option in
fedify initDepends on #674.
Changes
@fedify/initfedify init.Users can now scaffold a new Fedify project with Nuxt integration
across all supported package managers (npm, pnpm, yarn, Bun, Deno).
New files
src/webframeworks/nuxt.ts:WebFrameworkDescriptionfor Nuxt,including
nuxi initscaffolding command, dependency resolution forboth Node.js and Deno environments, and template file mapping.
src/templates/nuxt/nuxt.config.ts.tpl: Minimal Nuxt configtemplate with SSR disabled and devtools enabled.
src/templates/nuxt/server/federation.ts.tpl: Federationinstance setup with
MemoryKvStoreand a basic actor dispatcher.src/templates/nuxt/server/logging.ts.tpl: LogTapeconfiguration for Nuxt and Fedify loggers.
src/templates/nuxt/server/middleware/federation.ts.tpl: Nitroevent handler that delegates requests to
federation.fetch(),falling through to Nuxt on 404.
Modified files
src/const.ts: Added"nuxt"to theWEB_FRAMEWORKarray.src/webframeworks/mod.ts: Imported and registered the Nuxtframework description.
src/json/deps.json: Added@nuxt/kit,h3,nuxi, andnuxtversion pins.src/test/port.ts: Added port replacement logic for Nuxt(injects
nitro.portintonuxt.config.ts).Co-Authored-By: GPT-5.4